/*eslint-disable */
import React, {PureComponent} from 'react';
import {localize} from './localize';
import PropTypes from 'prop-types';
import moment from 'moment';
import {Row, Col, Card, List, Avatar, Divider, Tooltip, Icon, Spin, Calendar, Badge} from 'antd';
import PageHeaderLayout from './PageHeaderLayout';
import styles from './Workplace.css';
import Ellipsis from 'ant-design-pro/lib/Ellipsis';
import {hasPermissions, companyType, saleOrderStatus, saleOrderBusinessType, salesConfirmationStatus} from './utils';
import {PERMISSION} from './constants';

class Workplace extends PureComponent {
    state = {
        loading: false
    };

    componentDidMount() {
        this.setState({
            loading: true
        });
        setTimeout(() => {
            this.setState({
                loading: false
            });
        }, 500);
    }

    renderActivities() {
        const list = this.props.noticeList;
        return list ? list.map(item => (
            <List.Item key={item.id}>
                <List.Item.Meta
                    avatar={<Avatar ><Icon type="notification" theme="filled"/></Avatar>}
                    title={
                        <span
                            dangerouslySetInnerHTML={{
                                __html: item.name
                            }}
                        />
                    }
                    description={
                        <div>
                            <a href={`/#/dcs/parts/notice/${item.id}/detail`} target="_blank">
                            <div
                                dangerouslySetInnerHTML={{
                                    __html: item.content
                                }}/></a>
                            <span className={styles.datetime} title={item.updatedAt}>
                                {moment(item.updatedAt).fromNow()}
                            </span>
                        </div>
                    }
                />
            </List.Item>
        )) : null;
    }

    render() {
        const {userName, company, claimSettlementList, workItem, expenseAdjustmentList, assistPart, servicePrice,
            partOrderPlan, partBackOrder, partStock, claimApplyList, salePlanOrderSubmitList, salePlanOrderApproveList, 
            partOrderPlanRejectList, partOrderPlanApproveList, partSaleOrderRejectList, partSaleOrderApproveList, partOrderPIConfirmList,
            partOrderPIPayList, partSaleOrderCreateList, partOrderPICreateList, stockRequirementUploadList,
            invoiceAddKd,
            invoiceAddCbu,
            invoiceConfirmKd,
            CBUSaleOrderReject,
            KDSaleOrderReject,
            saleConfirmationRejectCbu,
            saleConfirmationRejectKd,
            invoiceConfirmCbu,
            partClaimReject,
            partClaimDecisionConfirm,
            partClaimCacuConfirm,
            partClaimApprove,
            packingListCabinetApply,
            partShipOrderCreate,
            exchangeRate,
            workingDay,
            partShipmentReceipt,
        } = this.props;
        const claimSettlementSlice = claimSettlementList.slice(0, 5);
        const expenseAdjustmentSlice = expenseAdjustmentList.slice(0, 5);
        const claimApplySlice = claimApplyList.slice(0, 5);
        const partOrderPlanRejectSlice = partOrderPlanRejectList.slice(0, 5);
        const partSaleOrderRejectSlice = partSaleOrderRejectList.slice(0, 5);
        const partOrderPIConfirmSlice = partOrderPIConfirmList.slice(0, 5);
        const partOrderPIPaySlice = partOrderPIPayList.slice(0, 5);
        const partClaimRejectSlice = partClaimReject.slice(0, 5);
        const partClaimDecisionConfirmSlice = partClaimDecisionConfirm.slice(0, 5);
        const partClaimCacuConfirmSlice = partClaimCacuConfirm.slice(0, 5);
        const partShipmentReceiptSlice = partShipmentReceipt.slice(0, 5);
        const pageHeaderContent = (
            <div className={styles.pageHeaderContent}>
                <div className={styles.avatar}>
                    <Avatar size={64} icon="user" />
                </div>
                <div className={styles.content}>
                    <div className={styles.contentTitle}>
                        {this.props.intl.formatMessage({
                            id: 'workplace.welcome.content',
                            defaultMessage: '您好，祝您开心每一天！'
                        })}
                    </div>
                    <div>
                        {userName} | {company && company.name}
                    </div>
                </div>
            </div>
        );
        const Yes = this.props.intl.formatMessage({
            id: 'workplace.yes',
            defaultMessage: '是'
        });
        const No = this.props.intl.formatMessage({
            id: 'workplace.no',
            defaultMessage: '无'
        });
        return (
            <PageHeaderLayout content={pageHeaderContent}>
                {(this.props.companyType === companyType.主机厂 || this.props.companyType === companyType.总代) ?
                 <Row>
                    <Col>
                        <Card
                            className={styles.projectList}
                            style={{
                                marginBottom: 24
                            }}
                            title={this.props.intl.formatMessage({
                                id: 'workplace.working',
                                defaultMessage: '进行中的工作'
                            })}
                            bordered={false}
                            bodyStyle={{
                                padding: 0
                            }}>
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.claimSettlement) &&
                            <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.claimSettlement.assignmentFollow',
                                                        defaultMessage: '保修结算通知'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/afterSales/claimSettlement/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {claimSettlementSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/afterSales/claimSettlement/${d.id}/detail`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/afterSales/claimSettlement?status=5`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.claimApply) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.claimApply.assignmentFollow',
                                                        defaultMessage: '待审核索赔预申请单'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/afterSales/claimApply/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {claimApplySlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/afterSales/claimApply/${d.id}/approve`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/afterSales/claimApply`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partOrderPlanReject) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partOrderPlan.reject',
                                                        defaultMessage: '备件需求计划驳回提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPlan/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {partOrderPlanRejectSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/parts/partOrderPlan/${d.id}/detail`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/parts/partOrderPlan`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.partOrderPlanApprove) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partOrderPlan.approve',
                                                        defaultMessage: '备件需求计划审核提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPlan/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partOrderPlanApproveList.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPlan/?status=2"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partOrderPlanApproveList.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partSaleOrderReject) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partSaleOrder.reject',
                                                        defaultMessage: '备件销售订单驳回提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partSaleOrder/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {partSaleOrderRejectSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/parts/partSaleOrder/${d.id}/detail`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/parts/partSaleOrder`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.partSaleOrderApprove) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partSaleOrder.approve',
                                                        defaultMessage: '备件销售订单审核提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partSaleOrder/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partSaleOrderApproveList.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/partSaleOrder/?status=2"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partSaleOrderApproveList.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partOrderPIConfirm) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partOrderPI.confirm',
                                                        defaultMessage: 'PI确认提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPI/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {partOrderPIConfirmSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/parts/partOrderPI/${d.id}/confirm`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/parts/partOrderPI?status=1`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partOrderPIPay) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partOrderPI.pay',
                                                        defaultMessage: 'PI付款提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPI/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {partOrderPIPaySlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/parts/partOrderPI/${d.id}/detail`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/parts/partOrderPI`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.partSaleOrderCreate) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partSaleOrder.create',
                                                        defaultMessage: 'PI生成提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partSaleOrder/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partSaleOrderCreateList.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/partSaleOrder/?status=3&isPI=false"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partSaleOrderCreateList.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.partOrderPICreate) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partOrderPI.create',
                                                        defaultMessage: '备货需求生成提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPI/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partOrderPICreateList.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPI/?status=3&IsStockRequirement=false"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partOrderPICreateList.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.stockRequirementUpload) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.stockRequirement.upload',
                                                        defaultMessage: '备货需求上传SAP提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/stockRequirement/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={stockRequirementUploadList.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/stockRequirement/?status=1"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {stockRequirementUploadList.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.salePlanOrderSubmit) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.salePlanOrderSubmit.assignmentFollow',
                                                        defaultMessage: '整车滚动计划未提报通知'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/sales/salePlanOrder/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={salePlanOrderSubmitList.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/salePlanOrder/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {salePlanOrderSubmitList.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}{this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.salePlanOrderApprove) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.salePlanOrderApprove.assignmentFollow',
                                                        defaultMessage: '整车滚动计划未审核通知'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/sales/salePlanOrder/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={salePlanOrderApproveList.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/salePlanOrder/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {salePlanOrderApproveList.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.expenseAdjustment) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.expenseAdjustment.assignmentFollow',
                                                        defaultMessage: '扣补款通知'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/afterSales/expenseAdjustment/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {expenseAdjustmentSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/afterSales/expenseAdjustment/${d.id}/detail`} target="_blank">
                                                                <Badge status="processing" text={d.code}/>
                                                            </a> {index === 4 && <a className={styles.more} href={`/#/dcs/afterSales/expenseAdjustment?status=3`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partOrderPlan) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partOrderPlan.assignmentFollow',
                                                        defaultMessage: '备件需求计划提报提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPlan/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partOrderPlan.isExist ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/partOrderPlan/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partOrderPlan.isExist ? Yes : No}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.backorder) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.backorder.assignmentFollow',
                                                        defaultMessage: 'Back order 确认提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partBackOrder/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partBackOrder.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/partBackOrder/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partBackOrder.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partStock) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partStock.assignmentFollow',
                                                        defaultMessage: '导入经销库存数据提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partStock/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partStock.isExist ? {backgroundColor: '#52c41a' } : {backgroundColor: '#6f6f6f' }}>
                                                    <a
                                                        href="/#/dcs/parts/partStock/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partStock.isExist ? Yes : No}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.workingHour) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.workingHours.appointment',
                                                        defaultMessage: '待维护工时'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/afterSales/workItem/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={workItem.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/afterSales/workItem/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {workItem.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.assistPart) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.assistPart',
                                                        defaultMessage: '待维护辅料'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={assistPart.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/afterSales/workItem/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {assistPart.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.servicePrice) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.servicePrice',
                                                        defaultMessage: '待维护当月索赔价'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={servicePrice.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/afterSales/workItem/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {servicePrice.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.invoiceAddKd) &&
                            <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.invoiceAddKd',
                                                        defaultMessage: 'PI确认提醒（KD）'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={invoiceAddKd.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/saleProformaInvoiceKd/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {invoiceAddKd.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.invoiceAddCbu) &&
                            <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.invoiceAddCbu',
                                                        defaultMessage: 'PI确认提醒（CBU）'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={invoiceAddCbu.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/saleProformaInvoice/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {servicePrice.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.invoiceConfirmKd) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.invoiceConfirmKd',
                                                        defaultMessage: 'PI已确认提醒（KD）'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={invoiceConfirmKd.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/saleProformaInvoiceKd/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {invoiceConfirmKd.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.CBUSaleOrderReject) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.CBUSaleOrderReject',
                                                        defaultMessage: '销售订单驳回提醒（CBU）'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={CBUSaleOrderReject.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/CBUSaleOrder/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {CBUSaleOrderReject.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.KDSaleOrderReject) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.KDSaleOrderReject',
                                                        defaultMessage: '销售订单驳回提醒（KD）'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={KDSaleOrderReject.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/KDSaleOrder/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {KDSaleOrderReject.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.saleConfirmationRejectCbu) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.saleConfirmationRejectCbu',
                                                        defaultMessage: '销售确认书驳回提醒（CBU）'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={saleConfirmationRejectCbu.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/saleConfirmationCbu/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {saleConfirmationRejectCbu.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.saleConfirmationRejectKd) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.saleConfirmationRejectKd',
                                                        defaultMessage: '销售确认书驳回提醒（KD）'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={saleConfirmationRejectKd.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/saleConfirmationKd/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {saleConfirmationRejectKd.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.invoiceConfirmCbu) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.isFetching}>
                                    <Card.Meta
                                        title={
                                            <div className={styles.cardTitle}>
                                                {/* <a
                                                    href="/#/dcs/afterSales/workItem/"
                                                    style={{
                                                        float: 'right'
                                                    }}>
                                                    <Icon type="link" />
                                                </a> */}
                                                <Ellipsis tooltip fullWidthRecognition length={40}>
                                                    {this.props.intl.formatMessage({
                                                        id: 'workplace.invoiceConfirmCbu',
                                                        defaultMessage: 'PI已确认提醒（CBU）'
                                                    })}
                                                </Ellipsis>
                                            </div>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={invoiceConfirmCbu.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/sales/saleProformaInvoice/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {invoiceConfirmCbu.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partClaimReject) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partClaim.reject',
                                                        defaultMessage: '备件索赔单驳回提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partClaim/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {partClaimRejectSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/parts/partClaim/${d.id}/detail`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/parts/partClaim`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partClaimDecisionConfirm) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partClaimDecision.confirm',
                                                        defaultMessage: '备件索赔判定书确认提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partClaimDecision/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {partClaimDecisionConfirmSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/parts/partClaimDecision/${d.id}/confirm`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/parts/partClaimDecision`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partClaimCacuConfirm) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partClaimCacu.confirm',
                                                        defaultMessage: '备件索赔发票确认提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partClaimCacu/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {partClaimCacuConfirmSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/parts/partClaimCacu/${d.id}/confirmor`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/parts/partClaimCacu`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        } 
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.partClaimApprove) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partClaim.approve',
                                                        defaultMessage: '备件索赔单审核提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partClaim/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partClaimApprove.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/partClaim/?status=2"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partClaimApprove.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.packingListCabinetApply) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.packingListCabinetApply',
                                                        defaultMessage: '箱单排柜提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/packingListCabinetApply/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={packingListCabinetApply.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/packingListCabinetApply/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {packingListCabinetApply.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.partShipOrderCreate) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partShipOrder.create',
                                                        defaultMessage: '货运委托书生成提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partShipOrder/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={partShipOrderCreate.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/partShipOrder/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {partShipOrderCreate.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.exchangeRate) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.exchangeRate',
                                                        defaultMessage: '新增汇率提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/exchangeRate/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={exchangeRate.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/exchangeRate/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {exchangeRate.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType === companyType.主机厂 && hasPermissions(this.props.permissions, PERMISSION.workingDay) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.workingDay',
                                                        defaultMessage: '工作日历维护提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/workingDay/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <Avatar style={workingDay.quantity ? {backgroundColor: '#52c41a'} : {backgroundColor: '#6f6f6f'}}>
                                                    <a
                                                        href="/#/dcs/parts/workingDay/"
                                                        style={{
                                                            float: 'right',
                                                            color:'#ffffff'
                                                        }}>
                                                        {workingDay.quantity || 0}
                                                    </a>
                                                </Avatar>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                            {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.partShipmentReceipt) && <Card.Grid className={styles.projectGrid}>
                                <Card
                                    bodyStyle={{
                                        padding: 0
                                    }}
                                    bordered={false}
                                    loading={this.state.loading}>
                                    <Card.Meta
                                        title={
                                            <Row className={styles.cardTitle}>
                                                <Col span={20}>
                                                    <Ellipsis tooltip fullWidthRecognition length={40}>
                                                        {this.props.intl.formatMessage({
                                                        id: 'workplace.partShipmentSignFor.receipt',
                                                        defaultMessage: '订单签收提醒'
                                                    })}</Ellipsis>
                                                </Col>
                                                <Col span={4}>
                                                    <a
                                                        href="/#/dcs/parts/partShipmentSignFor/"
                                                        style={{
                                                            float: 'right'
                                                        }}>
                                                        <Icon type="link" />
                                                    </a>
                                                </Col>
                                            </Row>
                                        }
                                        description={
                                            <div>
                                                <ul className={styles.rankingList}>
                                                    {partShipmentReceiptSlice.map((d, index) =>
                                                        <div>
                                                            <a href={`/#/dcs/parts/partShipmentSignFor/${d.id}/signfor`} target="_blank">
                                                                <Badge status="processing" text={d.code}/></a> 
                                                            {index === 4 && <a className={styles.more} href={`/#/dcs/parts/partShipmentSignFor`} target="_blank">more</a>}
                                                        </div>
                                                    )}
                                                </ul>
                                            </div>
                                        }
                                    />
                                </Card>
                            </Card.Grid>}
                        </Card>
                        {this.props.companyType == companyType.总代 && hasPermissions(this.props.permissions, PERMISSION.notification) && <Card
                            bodyStyle={{
                                padding: 0
                            }}
                            bordered={false}
                            className={styles.activeCard}
                            title={this.props.intl.formatMessage({
                                id: 'workplace.notification',
                                defaultMessage: '通知通告'
                            })}
                            loading={this.state.loading}>
                            <List loading={this.state.loading} size="large">
                                <div className={styles.activitiesList}>{this.renderActivities()}</div>
                            </List>
                        </Card>}
                    </Col>
                </Row> : <div className="page-main">
                    <div style={{
                            textAlign:'center',
                            marginTop:'300px',
                            fontSize: '54px',
                            color:'#808080'
                        }}>Chery International Distributer/Dealer Management System</div>
                </div>}
            </PageHeaderLayout>
        );
    }
}

Workplace.propTypes = {
    claimSettlementList: PropTypes.array,
    expenseAdjustmentList: PropTypes.array,
    company: PropTypes.object,
    userName: PropTypes.string,
    intl: PropTypes.object,
    noticeList: PropTypes.array,
    workItem: PropTypes.object,
    assistPart: PropTypes.object,
    servicePrice: PropTypes.object,
    partOrderPlan: PropTypes.object,
    partBackOrder: PropTypes.object,
    partStock: PropTypes.object,
    permissions: PropTypes.array.isRequired,
    companyType: PropTypes.number,
    claimApplyList: PropTypes.array,
    salePlanOrderSubmitList: PropTypes.object,
    salePlanOrderApproveList: PropTypes.object,
    partOrderPlanRejectList: PropTypes.array,
    partOrderPlanApproveList: PropTypes.object,
    partSaleOrderRejectList: PropTypes.array,
    partSaleOrderApproveList: PropTypes.object,
    partOrderPIConfirmList: PropTypes.array,
    partOrderPIPayList: PropTypes.array,
    partSaleOrderCreateList: PropTypes.object,
    partOrderPICreateList: PropTypes.object,
    stockRequirementUploadList: PropTypes.object,
    invoiceAddKd: PropTypes.object,
    invoiceAddCbu: PropTypes.object,
    invoiceConfirmKd: PropTypes.object,
    invoiceConfirmCbu: PropTypes.object,
    CBUSaleOrderReject: PropTypes.object,
    KDSaleOrderReject: PropTypes.object,
    saleConfirmationRejectCbu: PropTypes.object,
    saleConfirmationRejectKd: PropTypes.object,
    partClaimReject: PropTypes.array,
    partClaimDecisionConfirm: PropTypes.array,
    partClaimCacuConfirm: PropTypes.array,
    partClaimApprove: PropTypes.object,
    packingListCabinetApply: PropTypes.object,
    partShipOrderCreate: PropTypes.object,
    exchangeRate: PropTypes.object,
    workingDay: PropTypes.object,
    partShipmentReceipt: PropTypes.array,
};
import {connect} from 'react-redux';
import {selectorFactory} from 'Shared/utils/immutableToJsSelectorFactory';
const getCompanyInfo = selectorFactory(['page', 'domainData', 'initData', 'currentCompany']);
const getNoticeInfo = selectorFactory(['page', 'domainData', 'noticeData', 'data']);
const getClaimSettlementInfo = selectorFactory(['page', 'domainData', 'claimSettlementData', 'data']);
const getExpenseAdjustmentInfo = selectorFactory(['page', 'domainData', 'expenseAdjustmentData', 'data']);
const getWorkItemInfo = selectorFactory(['page', 'domainData', 'workItemData', 'data']);
const getAssistPartInfo = selectorFactory(['page', 'domainData', 'userDefinedAssistPartData', 'data']);
const getServicePriceInfo = selectorFactory(['page', 'domainData', 'partServicePriceData', 'data']);
const getPartOrderPlanData = selectorFactory(['page', 'domainData', 'partOrderPlanData', 'data']);
const getPartBackOrderData = selectorFactory(['page', 'domainData', 'partBackOrderData', 'data']);
const getPartStockData = selectorFactory(['page', 'domainData', 'partStockData', 'data']);
const getPermissions = selectorFactory(['page', 'domainData', 'permission', 'data']);
const getClaimApplyInfo = selectorFactory(['page', 'domainData', 'claimApplyData', 'data']);
const getsalePlanOrderSubmitInfo = selectorFactory(['page', 'domainData', 'salePlanOrderSubmit', 'data']);
const getsalePlanOrderApproveInfo = selectorFactory(['page', 'domainData', 'salePlanOrderApprove', 'data']);
const getPartOrderPlanRejectInfo = selectorFactory(['page', 'domainData', 'partOrderPlanReject', 'data']);
const getPartOrderPlanApproveInfo = selectorFactory(['page', 'domainData', 'partOrderPlanApprove', 'data']);
const getPartSaleOrderRejectInfo = selectorFactory(['page', 'domainData', 'partSaleOrderReject', 'data']);
const getPartSaleOrderApproveInfo = selectorFactory(['page', 'domainData', 'partSaleOrderApprove', 'data']);
const getPartOrderPIConfirmInfo = selectorFactory(['page', 'domainData', 'partOrderPIConfirm', 'data']);
const getPartOrderPIPayInfo = selectorFactory(['page', 'domainData', 'partOrderPIPay', 'data']);
const getPartSaleOrderCreateInfo = selectorFactory(['page', 'domainData', 'partSaleOrderCreate', 'data']);
const getPartOrderPICreateInfo = selectorFactory(['page', 'domainData', 'partOrderPICreate', 'data']);
const getStockRequirementUploadInfo = selectorFactory(['page', 'domainData', 'stockRequirementUpload', 'data']);
const getInvoiceAddKdInfo = selectorFactory(['page', 'domainData', 'invoiceAddKd', 'data']);
const getInvoiceAddCbuInfo = selectorFactory(['page', 'domainData', 'invoiceAddCbu', 'data']);
const getInvoiceConfirmKdInfo = selectorFactory(['page', 'domainData', 'invoiceConfirmKd', 'data']);
const getInvoiceConfirmCbuInfo = selectorFactory(['page', 'domainData', 'invoiceConfirmCbu', 'data']);
const getCBUSaleOrderRejectInfo = selectorFactory(['page', 'domainData', 'CBUSaleOrderReject', 'data']);
const getKDSaleOrderRejectInfo = selectorFactory(['page', 'domainData', 'KDSaleOrderReject', 'data']);
const getSaleConfirmationRejectCbuInfo = selectorFactory(['page', 'domainData', 'saleConfirmationRejectCbu', 'data']);
const getSaleConfirmationRejectKdInfo = selectorFactory(['page', 'domainData', 'saleConfirmationRejectKd', 'data']);
const getPartClaimRejectInfo = selectorFactory(['page', 'domainData', 'partClaimReject', 'data']);
const getPartClaimDecisionConfirmInfo = selectorFactory(['page', 'domainData', 'partClaimDecisionConfirm', 'data']);
const getPartClaimCacuConfirmInfo = selectorFactory(['page', 'domainData', 'partClaimCacuConfirm', 'data']);
const getPartClaimApproveInfo = selectorFactory(['page', 'domainData', 'partClaimApprove', 'data']);
const getPackingListCabinetApplyInfo = selectorFactory(['page', 'domainData', 'packingListCabinetApply', 'data']);
const getPartShipOrderCreateInfo = selectorFactory(['page', 'domainData', 'partShipOrderCreate', 'data']);
const getExchangeRateInfo = selectorFactory(['page', 'domainData', 'exchangeRate', 'data']);
const getWorkingDayInfo = selectorFactory(['page', 'domainData', 'workingDay', 'data']);
const getPartShipmentReceiptInfo = selectorFactory(['page', 'domainData', 'partShipmentReceipt', 'data']);

const mapStateToProps = state => ({
    userName: state.getIn(['page', 'domainData', 'initData', 'userName']),
    companyType: state.getIn((['page', 'domainData', 'initData', 'companyType'])),
    company: getCompanyInfo(state),
    noticeList: getNoticeInfo(state),
    claimSettlementList: getClaimSettlementInfo(state),
    expenseAdjustmentList: getExpenseAdjustmentInfo(state),
    workItem: getWorkItemInfo(state),
    assistPart: getAssistPartInfo(state),
    servicePrice: getServicePriceInfo(state),
    partOrderPlan: getPartOrderPlanData(state),
    partBackOrder: getPartBackOrderData(state),
    partStock: getPartStockData(state),
    permissions: getPermissions(state),
    claimApplyList: getClaimApplyInfo(state),
    salePlanOrderSubmitList: getsalePlanOrderSubmitInfo(state),
    salePlanOrderApproveList: getsalePlanOrderApproveInfo(state),
    partOrderPlanRejectList: getPartOrderPlanRejectInfo(state),
    partOrderPlanApproveList: getPartOrderPlanApproveInfo(state),
    partSaleOrderRejectList: getPartSaleOrderRejectInfo(state),
    partSaleOrderApproveList: getPartSaleOrderApproveInfo(state),
    partOrderPIConfirmList: getPartOrderPIConfirmInfo(state),
    partOrderPIPayList: getPartOrderPIPayInfo(state),
    partSaleOrderCreateList: getPartSaleOrderCreateInfo(state),
    partOrderPICreateList: getPartOrderPICreateInfo(state),
    stockRequirementUploadList: getStockRequirementUploadInfo(state),
    invoiceAddKd: getInvoiceAddKdInfo(state),
    invoiceAddCbu: getInvoiceAddCbuInfo(state),
    invoiceConfirmKd: getInvoiceConfirmKdInfo(state),
    invoiceConfirmCbu: getInvoiceConfirmCbuInfo(state),
    CBUSaleOrderReject: getCBUSaleOrderRejectInfo(state),
    KDSaleOrderReject: getKDSaleOrderRejectInfo(state),
    saleConfirmationRejectCbu: getSaleConfirmationRejectCbuInfo(state),
    saleConfirmationRejectKd: getSaleConfirmationRejectKdInfo(state),
    partClaimReject: getPartClaimRejectInfo(state),
    partClaimDecisionConfirm: getPartClaimDecisionConfirmInfo(state),
    partClaimCacuConfirm: getPartClaimCacuConfirmInfo(state),
    partClaimApprove: getPartClaimApproveInfo(state),
    packingListCabinetApply: getPackingListCabinetApplyInfo(state),
    partShipOrderCreate: getPartShipOrderCreateInfo(state),
    exchangeRate: getExchangeRateInfo(state),
    workingDay: getWorkingDayInfo(state),
    partShipmentReceipt: getPartShipmentReceiptInfo(state),
});

export default connect(
    mapStateToProps,
    null
)(localize(Workplace));
